<template>
  <div class="table-container">
    <div class="table-breadcrumb">
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item :to="{path:'activityList'}">活动列表</el-breadcrumb-item>
        <el-breadcrumb-item>点赞列表</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="table-search">
      <el-row>
<!--        <el-input-->
<!--          style="width: 200px;margin-right: 10px"-->
<!--          placeholder="请输入关键字检索"-->
<!--          v-model="keyword"-->
<!--          clearable-->
<!--          @clear="queryList"-->
<!--        >-->
<!--        </el-input>-->
<!--        <el-button type="primary" @click="queryList">搜索</el-button>-->
      </el-row>
    </div>
    <div class="table-content">
      <div class="table-bar">

      </div>
      <el-table
        border
        empty-text="当前数据空空如也"
        ref="multipleTable"
        :data="supportList"
        tooltip-effect="dark"
        style="width: 100%"
      >
        <el-table-column prop="id" label="ID" width="60"></el-table-column>
        <el-table-column prop="username" label="用户昵称"></el-table-column>
        <el-table-column prop="mobile" label="电话" width="auto"></el-table-column>
        <el-table-column prop="all_num" label="点赞天数" width="auto">
        </el-table-column>
        <el-table-column prop="withdraw_money" label="已提现金额" width="auto">
        </el-table-column>
        <el-table-column prop="money" label="未提现金额" width="auto"></el-table-column>
        <el-table-column label="操作" fixed="right">
          <template slot-scope="scope">
            <el-button
              size="mini"
              style="margin-right: 5px"
              @click="handlePush(scope.$index, scope.row)">推送
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="page-nav">
        <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="page"
          :page-sizes="[10, 20, 30, 50,100]"
          :page-size="pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total">
        </el-pagination>
      </div>
    </div>


  </div>
</template>

<script>
  export default {
    data() {
      return {
        page: 1,
        pageSize: 10,
        total: 0,
        keyword: '',
        supportList: [],
      }
    },
    mounted() {
      this.queryList();
    },
    methods: {
      handlePush(index, row) {
        this.$http.post('/api/root/party/pushMsg', {
          id: row.id
        }).then(rest => {
          if(rest.msg === 'ok'){
            this.$message.success('操作成功');
          }else{
            this.$message.error(rest.msg);
          }
        })
      },

      handleSizeChange(val) {
        this.pageSize = val;
        this.page = 1;
        this.queryList()
      },
      handleCurrentChange(val) {
        this.page = val;
        this.queryList();
      },
      queryList() {
        let party_id = this.$route.query.id?this.$route.query.id:'';
        this.$http.get('/api/root/party/supportList', {
          page: this.page,
          pagesize: this.pageSize,
          keyword: this.keyword,
          party_id
        }).then(rest => {
          if (rest.code == 1) {
            this.supportList = rest.data.data;
            this.total = rest.data.count;
          }
        })
      },
    }
  }
</script>
<style lang="less" scoped>
  @import 'index.less';
</style>
